<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require_once("track.inc.php");
require_once("database.inc.php");
require_once("../HT_Client/HT_Client.class.php");

hit();

$beenthere = array();
$beenhere = array();

#echo "#If you are still using this, contact me!";
if ($_GET['login'] && $_GET['seccode']) {
	$agent = "Maptrick Cup Flagchecker (by CHPP-ste1n)";
	$client = new HT_Client($agent);
        if (!$client->Login($_GET['login'],$_GET['seccode'],$agent)) die ("aborting, try again later\n");
	if (is_numeric($_GET['teamid']) && $_GET['teamid'] > 0) {
		$flags = $client->getFlags($_GET['teamid']);
	} else {
		$flags = $client->getFlags();
	}
#	var_dump($flags);
	$homeflags = array_keys($flags['away']);
	$awayflags = array_keys($flags['home']);
	sort($homeflags, SORT_NUMERIC);
	sort($awayflags, SORT_NUMERIC);
	foreach($homeflags as $flag) {
		echo "$flag,";
	}
	echo "\n";
	foreach($awayflags as $flag) {
		echo "$flag,";
	}
	echo "\n";
}
